﻿Public Class Form1

    Dim caps As Boolean = False
    
    Private Sub bnt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt.Click
        txt.Text = txt.Text + "`"
    End Sub

    Private Sub txt_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txt.KeyDown
        
    End Sub

    Private Sub txt_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txt.TextChanged
        txt.ReadOnly = True

    End Sub

    Private Sub bnt1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt1.Click

        txt.Text = txt.Text + "1"
    End Sub

    Private Sub bnt2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt2.Click
        txt.Text = txt.Text + "2"
    End Sub

    Private Sub bnt3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt3.Click
        txt.Text = txt.Text + "3"
    End Sub

    Private Sub bnt4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt4.Click
        txt.Text = txt.Text + "4"
    End Sub

    Private Sub bnt5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt5.Click
        txt.Text = txt.Text + "5'"
    End Sub

    Private Sub bnt6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt6.Click
        txt.Text = txt.Text + "6"
    End Sub

    Private Sub bnt7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt7.Click
        txt.Text = txt.Text + "7"
    End Sub

    Private Sub bnt8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt8.Click
        txt.Text = txt.Text + "8"
    End Sub

    Private Sub bnt9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt9.Click
        txt.Text = txt.Text + "9"
    End Sub

    Private Sub bnt0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnt0.Click
        txt.Text = txt.Text + "0"
    End Sub

    Private Sub bnttru_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnttru.Click
        txt.Text = txt.Text + "-"
    End Sub

    Private Sub bntbang_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntbang.Click
        txt.Text = txt.Text + "="
    End Sub

    Private Sub bntq_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntq.Click
        If caps = True Then
            txt.Text = txt.Text + "Q"
        Else
            txt.Text = txt.Text + "q"
        End If
    End Sub

    Private Sub bntw_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntw.Click
        If caps = True Then
            txt.Text = txt.Text + "W"
        Else
            txt.Text = txt.Text + "w"
        End If
    End Sub

    Private Sub bnte_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnte.Click
        If caps = False Then
            txt.Text = txt.Text + "e"
        Else
            txt.Text = txt.Text + "E"
        End If
    End Sub

    Private Sub bntr_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntr.Click
        If caps = False Then
            txt.Text = txt.Text + "r"
        Else
            txt.Text = txt.Text + "R"
        End If
    End Sub

    Private Sub bntt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntt.Click
        If caps = False Then
            txt.Text = txt.Text + "t"
        Else
            txt.Text = txt.Text + "T"
        End If

    End Sub

    Private Sub bnty_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnty.Click
        If caps = False Then
            txt.Text = txt.Text + "y"
        Else
            txt.Text = txt.Text + "Y"
        End If
    End Sub

    Private Sub bntu_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntu.Click
        If caps = False Then
            txt.Text = txt.Text + "u"
        Else
            txt.Text = txt.Text + "U"
        End If
    End Sub

    Private Sub bnti_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnti.Click
        If caps = False Then
            txt.Text = txt.Text + "i"
        Else
            txt.Text = txt.Text + "I"
        End If
    End Sub

    Private Sub bnto_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnto.Click
        If caps = False Then
            txt.Text = txt.Text + "o"
        Else
            txt.Text = txt.Text + "O"
        End If
    End Sub

    Private Sub bntp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntp.Click
        If caps = False Then
            txt.Text = txt.Text + "p"
        Else
            txt.Text = txt.Text + "P"
        End If
    End Sub

    Private Sub bntnv1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntnv1.Click
        txt.Text = txt.Text + "["
    End Sub

    Private Sub bntnv2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntnv2.Click
        txt.Text = txt.Text + "]"
    End Sub

    Private Sub bntxotrai_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntxotrai.Click
        txt.Text = txt.Text + "\"
    End Sub

    Private Sub bnta_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnta.Click
        If caps = False Then
            txt.Text = txt.Text + "a"
        Else
            txt.Text = txt.Text + "A"
        End If
    End Sub

    Private Sub bnts_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnts.Click
        If caps = False Then
            txt.Text = txt.Text + "s"
        Else
            txt.Text = txt.Text + "S"
        End If
    End Sub

    Private Sub bntd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntd.Click
        If caps = False Then
            txt.Text = txt.Text + "d"
        Else
            txt.Text = txt.Text + "D"
        End If
    End Sub

    Private Sub bntg_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntg.Click
        If caps = False Then
            txt.Text = txt.Text + "g"
        Else
            txt.Text = txt.Text + "G"
        End If
    End Sub

    Private Sub bntf_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntf.Click
        If caps = False Then
            txt.Text = txt.Text + "f"
        Else
            txt.Text = txt.Text + "F"
        End If
    End Sub

    Private Sub bnth_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnth.Click
        If caps = False Then
            txt.Text = txt.Text + "h"
        Else
            txt.Text = txt.Text + "H"
        End If
    End Sub

    Private Sub bntj_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntj.Click
        If caps = False Then
            txt.Text = txt.Text + "j"
        Else
            txt.Text = txt.Text + "J"
        End If
    End Sub

    Private Sub bntk_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntk.Click
        If caps = False Then
            txt.Text = txt.Text + "k"
        Else
            txt.Text = txt.Text + "K"
        End If
    End Sub

    Private Sub bntl_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntl.Click
        If caps = False Then
            txt.Text = txt.Text + "l"
        Else
            txt.Text = txt.Text + "L"
        End If
    End Sub

    Private Sub bnthaicham_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnthaicham.Click
        txt.Text = txt.Text + ":"
    End Sub

    Private Sub bntphayt_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntphayt.Click
        txt.Text = txt.Text + "'"
    End Sub

    Private Sub bntz_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntz.Click
        If caps = False Then
            txt.Text = txt.Text + "z"
        Else
            txt.Text = txt.Text + "Z"
        End If
    End Sub

    Private Sub bntx_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntx.Click
        If caps = False Then
            txt.Text = txt.Text + "x"
        Else
            txt.Text = txt.Text + "X"
        End If
    End Sub

    Private Sub bntc_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntc.Click
        If caps = False Then
            txt.Text = txt.Text + "c"
        Else
            txt.Text = txt.Text + "C"
        End If
    End Sub

    Private Sub bntv_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntv.Click
        If caps = False Then
            txt.Text = txt.Text + "v"
        Else
            txt.Text = txt.Text + "V"
        End If
    End Sub

    Private Sub bntb_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntb.Click
        If caps = False Then
            txt.Text = txt.Text + "b"
        Else
            txt.Text = txt.Text + "B"
        End If
    End Sub

    Private Sub bntn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntn.Click
        If caps = False Then
            txt.Text = txt.Text + "n"
        Else
            txt.Text = txt.Text + "N"
        End If
    End Sub

    Private Sub bntm_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntm.Click
        If caps = False Then
            txt.Text = txt.Text + "m"
        Else
            txt.Text = txt.Text + "M"
        End If
    End Sub

    Private Sub bntphayd_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntphayd.Click
        txt.Text = txt.Text + ","
    End Sub

    Private Sub bntcham_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntcham.Click
        txt.Text = txt.Text + "."
    End Sub

    Private Sub bntxophai_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntxophai.Click
        txt.Text = txt.Text + "/"

    End Sub

    Private Sub bntspace_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntspace.Click
        txt.Text = txt.Text + " "
    End Sub

    Private Sub Form1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
        Select Case e.KeyCode
            Case Keys.Oem3
                bnt_Click(sender, e)
                bnt.Focus()
            Case Keys.D1
                bnt1_Click(sender, e)
                bnt1.Focus()
            Case Keys.D2
                bnt2_Click(sender, e)
                bnt2.Focus()
            Case Keys.D3
                bnt3_Click(sender, e)
                bnt3.Focus()
            Case Keys.D4
                bnt4_Click(sender, e)
                bnt4.Focus()
            Case Keys.D5
                bnt5_Click(sender, e)
                bnt5.Focus()
            Case Keys.D6
                bnt6_Click(sender, e)
                bnt6.Focus()
            Case Keys.D7
                bnt7_Click(sender, e)
                bnt7.Focus()
            Case Keys.D8
                bnt8_Click(sender, e)
                bnt8.Focus()
            Case Keys.D9
                bnt9_Click(sender, e)
                bnt9.Focus()
            Case Keys.D0
                bnt0_Click(sender, e)
                bnt0.Focus()
            Case Keys.Tab
                bnttab_Click(sender, e)
                bnttab.Focus()
            Case Keys.Q
                bntq_Click(sender, e)
                bntq.Focus()
            Case Keys.W
                bntw_Click(sender, e)
                bntw.Focus()
            Case Keys.E
                bnte_Click(sender, e)
                bnte.Focus()
            Case Keys.R
                bntr_Click(sender, e)
                bntr.Focus()
            Case Keys.T
                bntt_Click(sender, e)
                bntt.Focus()
            Case Keys.Y
                bnty_Click(sender, e)
                bnty.Focus()
            Case Keys.U
                bntu_Click(sender, e)
                bntu.Focus()
            Case Keys.I
                bnti_Click(sender, e)
                bnti.Focus()
            Case Keys.O
                bnto_Click(sender, e)
                bnto.Focus()
            Case Keys.P
                bntp_Click(sender, e)
                bntp.Focus()
            Case Keys.CapsLock
                bntcap_Click(sender, e)
                bntcap.Focus()
            Case Keys.A
                bnta_Click(sender, e)
                bnta.Focus()
            Case Keys.S
                bnts_Click(sender, e)
                bnts.Focus()
            Case Keys.D
                bntd_Click(sender, e)
                bntd.Focus()
            Case Keys.F
                bntf_Click(sender, e)
                bntf.Focus()
            Case Keys.G
                bntg_Click(sender, e)
                bntg.Focus()
            Case Keys.H
                bnth_Click(sender, e)
                bnth.Focus()
            Case Keys.J
                bntj_Click(sender, e)
                bntj.Focus()
            Case Keys.K
                bntk_Click(sender, e)
                bntk.Focus()
            Case Keys.L
                bntl_Click(sender, e)
                bntl.Focus()
            Case Keys.Z
                bntz_Click(sender, e)
                bntz.Focus()
            Case Keys.X
                bntx_Click(sender, e)
                bntx.Focus()
            Case Keys.C
                bntc_Click(sender, e)
                bntc.Focus()
            Case Keys.V
                bntv_Click(sender, e)
                bntv.Focus()
            Case Keys.B
                bntb_Click(sender, e)
                bntb.Focus()
            Case Keys.N
                bntn_Click(sender, e)
                bntn.Focus()
            Case Keys.M
                bntm_Click(sender, e)
                bntm.Focus()
            Case Keys.ShiftKey
                Select Case e.KeyCode
                    Case Keys.A
                        If caps = False Then
                            txt.Text = txt.Text + "A"
                        Else
                            txt.Text = txt.Text + "a"
                        End If
                End Select
                bntship.Focus()
            Case Keys.Alt
                bntalt1_Click(sender, e)
                bntalt1.Focus()
            Case Keys.ControlKey
                bntctrlt1_Click(sender, e)
                bntctrlt1.Focus()
            Case Keys.Space
                bntspace.Focus()
                bntspace_Click(sender, e)
            Case Keys.OemMinus
                bnttru_Click(sender, e)
                bnttru.Focus()
            Case Keys.Oemplus
                bntbang_Click(sender, e)
                bntbang.Focus()
            Case Keys.OemOpenBrackets
                bntnv1_Click(sender, e)
                bntnv1.Focus()
            Case Keys.OemCloseBrackets
                bntnv2_Click(sender, e)
                bntnv2.Focus()
            Case Keys.OemPipe
                bntxotrai_Click(sender, e)
                bntxotrai.Focus()
            Case Keys.OemSemicolon
                bnthaicham_Click(sender, e)
                bnthaicham.Focus()
            Case Keys.OemQuotes
                bntphayt_Click(sender, e)
                bntphayt.Focus()
            Case Keys.Enter
                bntenter.Focus()
                bntenter_Click(sender, e)
            Case Keys.Oemcomma
                bntphayd_Click(sender, e)
                bntphayd.Focus()
            Case Keys.OemPeriod
                bntcham_Click(sender, e)
                bntcham.Focus()
            Case Keys.OemQuestion
                bntxophai_Click(sender, e)
                bntxophai.Focus()
            Case Keys.Back
                bntbsp_Click(sender, e)
                bntbsp.Focus()
        End Select

    End Sub

    Private Sub bntcap_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntcap.Click
        If caps = False Then
            caps = True
        Else
            caps = False
        End If
    End Sub

    Private Sub Form1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress

    End Sub

    Private Sub Form1_KeyUp(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyUp
        If e.Shift Then
            Select Case e.KeyCode
                Case Keys.A
                    If caps = False Then
                        txt.Text = txt.Text + "A"
                    Else
                        txt.Text = txt.Text + "a"
                    End If
            End Select

        End If
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.KeyPreview = True
    End Sub

    Private Sub bntenter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntenter.Click
        txt.Text = txt.Text & vbCrLf

    End Sub

    Private Sub bntlen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntlen.Click

    End Sub

    Private Sub bntbsp_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntbsp.Click
        Dim loc As Integer
        If txt.Text.Length > 0 Then
            loc = txt.Text.Length
            txt.Text = txt.Text.Remove(loc - 1, 1)
        End If
    End Sub

    Private Sub bnttab_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bnttab.Click

    End Sub

    Private Sub bntship_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntship.Click

    End Sub

    Private Sub bntctrlt1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntctrlt1.Click

    End Sub

    Private Sub bntalt1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntalt1.Click

    End Sub

    Private Sub bntalt2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntalt2.Click

    End Sub

    Private Sub bntctrlt2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles bntctrlt2.Click

    End Sub

    Private Sub bntxophai_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles bntxophai.KeyDown
        bntxophai.BackColor = Color.Aqua
    End Sub
End Class
